package com.xuecheng.base.exception;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author FengHuan Wang
 * @Date 2025/3/29 19:31
 * @Version 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GlobalException extends RuntimeException{
    private String errorMessage;

    public static void cast(String message){
        throw new GlobalException(message);
    }

    public static void cast(CommonError error){
        throw new GlobalException(error.getErrMessage());
    }
}
